<template>
  <div>

    <div class="mt-[32px] flex items-center">
      提前 <el-input v-style="`width:100px;`" class="mx-[10px]" v-model="day" /> 天告知即将过期
    </div>

  </div>
</template>
<script setup lang="ts">
import UploadImg from "@/components/UploadFile/src/UploadImg.vue"
import Icon from "@/components/Icon/src/Icon.vue";
import {listToMap, formError, deepCopy} from "@/utils";
import {getTenantWarningDay,setTenantWarningDay} from "@/api/system/tenant";

const props = defineProps({
  info: {
    type: Object,
    required: false,
    default: () => {
    }
  }
})

const day=ref(0)

const FormRef = ref(null);


const form = ref({})

const confirm = async (callback) => {

  try {


    let option = {
      warningDay:day.value
    }

    await setTenantWarningDay(option)

    callback && callback()
  } catch (e) {
    formError()
  }

}

const getData=async()=>{
  let res = await getTenantWarningDay();
  console.log(res)
  day.value = res || 0
}


onMounted(() => {
  getData();
})

defineExpose({
  confirm
})

watch(() => props.info, () => {
  form.value = props.info;
}, {
  deep: true,
  immediate: true
})

</script>
<style lang="scss" scoped>

</style>
